<!doctype html>
<html lang="{{ app()->getLocale() }}">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css">

    <title>Laravel</title>
    <style>
        html, body {
            background-color: #fff;
            color: #636b6f;
            font-family: 'Raleway', sans-serif;
            font-weight: 100;
            height: 100vh;
            margin: 0;
        }

        .full-height {
            height: 100vh;
        }

        .flex-center {
            align-items: center;
            display: flex;
            justify-content: center;
        }

        .position-ref {
            position: relative;
        }

        .top-right {
            position: absolute;
            right: 10px;
            top: 18px;
        }

        .content {
            text-align: center;
        }

        .title {
            font-size: 84px;
        }

        .links > a {
            color: #636b6f;
            padding: 0 25px;
            font-size: 12px;
            font-weight: 600;
            letter-spacing: .1rem;
            text-decoration: none;
            text-transform: uppercase;
        }

        .m-b-md {
            margin-bottom: 30px;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="content">
            <div class="title">
                <p>@{{ message }}</p>
                <input v-model="message"/>
                <ul>
                    <li v-for="todo in todos">
                        @{{ todo.text }}
                    </li>
                </ul>
            </div>
            <div class="click">
                <p>@{{ message }}</p>
                <span v-on:click="msgRev">消息翻转</span>
            </div>
            <div class="add">
                <input v-model="newTodo" v-on:keyup.enter="addTodo"/>
                <ul>
                    <li v-for="e in items">
                        <span>@{{ e.text }}</span>
                        <button v-on:click="rm(index)">X</button>
                    </li>
                </ul>
            </div>
            <div class="greeting">
                <p v-if="greeting">你好啊!!</p>
            </div>
        </div>
    </div>
</body>
<script type="text/javascript" src="{{asset('js/vue.js')}}"></script>
<script type="text/javascript">
    new Vue({
        el:'.title',
        data:{
            message:"hello Laraval",
            todos: [
                { text: 'Learn Laravel' },
                { text: 'Learn Vue.js' },
                { text: 'At LaravelAcademy.org' }
            ]
        }
    });
    new Vue({
        el:'.click',
        data:{
            message:'Laraval'
        },
        methods:{
            msgRev:function(){
                this.message = this.message.split('').reverse().join('');
            }
        }
    });
    new Vue({
        el:'.add',
        data:{
            newTodo:'',
            items:[
                {text:'新增Todo'}
            ]
        },
        methods:{
            addTodo:function(){
                var text = this.newTodo.trim();
                if(text){
                    this.items.push({text:text});
                    this.newTodo = '';
                }
            },
            rm:function (index) {
                this.items.splice(index,1)
            }
        }
    });
    new Vue({
        el:'.greeting',
        data:{
            greeting:false
        }
    });
</script>
</html>